// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:io';

import 'package:alfred/alfred.dart';

class RemoteServer {
  static const _address = "localhost";
  static const _port = 4399;
  final _server = Alfred();

  void start(
      Map<String, void Function(HttpRequest req, HttpResponse res)> handlers) async {
    for (var i in handlers.keys) {
      _server.get("/${i}", handlers[i]!);
    }
    _server.listen(_port);
  }

  void stop() {
    _server.close();
  }
}
